#ifndef _EVENT_HPP
#define _EVENT_HPP

#include "Function.hpp"
#include "Args.hpp"

namespace lua
{

class Event
{
public:
	static Event* add(const char *name, Function callbackFunc);
	static bool remove(const char *name, Function callbackFunc);
	static bool trigger(const char *eventName, Args args = Args(Module::currentModule));
	friend class EventManager;
private:
	Event(const char *name, Function callbackFunc);
	~Event(){ mCallbackFunc.unref(); }
private:
	const char *mName;
	Function mCallbackFunc;
};

}

#endif